@echo off
rem 设置代码页为UTF-8以支持中文
chcp 65001 > nul

echo =====================================================
echo         Installing dependencies - Image Cutter
echo =====================================================
echo.

rem 检查Python版本
python --version
if %ERRORLEVEL% neq 0 (
    echo Python is not installed or not in PATH. Please install Python 3.6+
    pause
    exit /b 1
)

rem 检查是否有虚拟环境
if exist image_cutter_env (
    echo Using existing virtual environment...
) else (
    echo Creating virtual environment...
    python -m venv image_cutter_env
)

echo.
echo Installing dependencies using Tsinghua mirror...
call image_cutter_env\Scripts\activate
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
call image_cutter_env\Scripts\deactivate

echo.
echo Dependencies installation completed.
echo =====================================================
timeout /t 3 > nul 